package cc.loac.heba.controller;

import cc.loac.heba.service.SchoolService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Controller
public class SchoolController {

    @Resource
    SchoolService schoolService;

    @GetMapping("/school")
    @ResponseBody
    public String getSchools(@RequestParam("email") String email,
                             HttpServletRequest request) {
        String token = request.getHeader("admin-token");
        return schoolService.getSchools(email, token);
    }
}
